package tq.com.tqstudent.views;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import tq.com.tqstudent.R;
import tq.com.tqstudent.ui.activity.LoginActivity;

/**
 * @Author rames
 * @date 2019/3/5 11:22
 */
public class LoginTipsDialog extends Dialog implements View.OnClickListener {
    private Context context;

    public LoginTipsDialog(@NonNull Context context) {
        super(context);
        this.context = context;
        init();
    }

    public LoginTipsDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
        init();
    }

    protected LoginTipsDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
        init();
    }

    private void init() {
        setContentView(R.layout.dialog_login_tips);
        setCancelable(false);
        findViewById(R.id.cancel_tv).setOnClickListener(this);
        findViewById(R.id.login_tv).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.login_tv:
                LoginActivity.show((AppCompatActivity) context);
                this.dismiss();
                break;

            case R.id.cancel_tv:
                this.dismiss();
                break;
        }
    }
}
